//package com.ruoyi.custom.controller;
//
//import com.ruoyi.common.security.utils.SecurityUtils;
//import org.apache.ibatis.annotations.Result;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.Map;
//import java.util.concurrent.CompletableFuture;
//
//@RestController
//@RequestMapping("/market/coupon")
//public class CouponController{
//    @Autowired
//    private CouponService couponService;
//
//    @PostMapping("/receive")
//    public Result receive(@RequestBody Map<String, Long> params) {
//        Long userId = SecurityUtils.getUserId(); // 从登录信息获取用户ID
//        Long couponId = params.get("couponId");
//        return couponService.receiveCoupon(userId, couponId);
//    }
//
//
//
//    @PostMapping("/batchSend")
//    public Result batchSend(@RequestBody Map<String, Object> params) {
//        Long couponId = Long.parseLong(params.get("couponId").toString());
//        List<Long> userIds = (List<Long>) params.get("userIds");
//
//        CompletableFuture<Boolean> future = couponService.batchSendCoupon(couponId, userIds);
//        return Result.success("发放任务已启动，将异步处理");
//    }
//
//    @GetMapping("/available")
//    public Result listAvailable() {
//        Long userId = SecurityUtils.getUserId();
//        List<Coupon> list = couponService.getAvailableCoupons(userId);
//        return Result.success(list);
//    }
//}
